const { defineConfig } = require('@vue/cli-service')

module.exports = defineConfig({
  // ... other config ...
  devServer: {
    port: 8080,
    proxy: {
      '/api': {
        target: 'http://localhost:8234',
        changeOrigin: true,
        // 添加日志
        // eslint-disable-next-line no-unused-vars
        onProxyReq(proxyReq, req, res) {
          console.log('Proxy Request:', req.method, req.url)
        },
        // eslint-disable-next-line no-unused-vars
        onProxyRes(proxyRes, req, res) {
          console.log('Proxy Response:', proxyRes.statusCode)
        }
      }
    }
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          javascriptEnabled: true
        }
      }
    }
  }
})
